package cn.jiedh.app.meiweidk.community;

import android.view.View;

import cn.jiedh.app.meiweidk.app.EnvConfig;
import cn.jiedh.app.meiweidk.web.WebFragment;

/**
 * @name：
 * @author： liuyun
 * @phone： 15723310658
 * @createTime： 2017/12/12
 * @modifyTime： 2017/12/12
 * @explain：说明
 */


public class CommunityFragment extends WebFragment{
    @Override
    public void initValues() {
        super.initValues();
        title="社区";
        mTitleView.setText(title);
//        mOriginUrl="file:///android_asset/WebViewJavascriptBridgeDemo.html";
        mOriginUrl= EnvConfig.COMMUNITY_URL;
        mWebView.post(new Runnable() {
            @Override
            public void run() {
                mWebView.loadUrl(mOriginUrl);
            }
        });
    }

    @Override
    protected void initTitleBar() {
        super.initTitleBar();
        mTitleBarBack.setVisibility(View.INVISIBLE);
    }

    @Override
    protected void initData() {
        super.initData();
//        mWebView.registerHandler("callNative", new WJBridgeHandler() {
//            @Override
//            public void handler(String data, WJCallbacks callbacks) {
//                Toast.makeText(getActivity().getApplicationContext(),data,Toast.LENGTH_SHORT).show();
//                callbacks.onCallback("callNative response data" + System.currentTimeMillis());
//            }
//        });
        /*getActivity().findViewById(R.id.test_id).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callHandlerJSToast();
            }
        });*/
    }
//    public void callHandlerJSToast(){
//        mWebView.callHandler("callJs", "{\"callJsData\":\"data\"}", new WJCallbacks() {
//            @Override
//            public void onCallback(String data) {
//                Toast.makeText(getActivity().getApplicationContext(),"callJs callback" + data,Toast.LENGTH_SHORT).show();
//            }
//        });
//    }
}
